#!/bin/bash
cd $(dirname $(readlink -f "$0"))
# echo Asia/Shanghai > /etc/timezone
#image=openjdk:jre
image=openjdk:8-jre
#image=cimg/openjdk:8.0
name=gateway
port=$1
# 更新
#docker pull $image
# 删除
docker rm -f $name$1
# 运行
docker run -d \
    --restart=always \
    --net=host \
    -v $PWD/jar:/jar \
    -v $PWD/logs:/logs \
    -v /etc/timezone:/etc/timezone:ro \
    -v /etc/localtime:/etc/localtime:ro \
    -e TZ="Asia/Shanghai" \
    -m 1.2G \
    --name=$name$1 \
    $image \
    java -jar -Xms512m -Xmx512m -Duser.timezone=GMT+08 -Dreactor.netty.ioWorkerCount=6 -Dreactor.netty.ioSelectCount=6 /jar/$name-0.0.1-SNAPSHOT.old.jar \
    --server.port=$port --loadBalancer.enableBalancer=tru 
    #java -jar -Xms512m -Xmx512m -Duser.timezone=GMT+08 -Dreactor.netty.ioWorkerCount=6 -Dreactor.netty.ioSelectCount=6 /jar/$name-0.0.1-SNAPSHOT.old.jar --server.port=$port --spring.cloud.nacos.discovery.server-addr=172.16.98.146:8848 --spring.cloud.gateway.httpclient.response-timeout=9s --logging.level.root=ERROR --spring.cloud.gateway.httpclient.pool.max-connections=500 --spring.cloud.gateway.httpclient.pool.max-idle-time=5000 --spring.cloud.gateway.httpclient.pool.eviction-interval=5000
